/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package former.queryFormers;

import former.AbstractConditionalFormer;
import Tables.AbstractTable;
import java.util.List;

/**
 *
 * @author FOE
 */
public class UpdateFormer extends AbstractConditionalFormer{

    @Override
    public String formQueryHelper(AbstractTable object) {
        initializeQuery(object);
        StringBuilder builder=new StringBuilder();
        builder.append("update ");
        builder.append(getTableName());
        builder.append(" set ");
        List columnsList = getColumnsList();
        List dataList = getDataList();
        for(int i=0;i<columnsList.size();i++)
        {
            if(i!=0)
            {
                builder.append(" , ");
            }
            builder.append(columnsList.get(i));
            builder.append(" = ");
            builder.append(" ? ");
        }
        
        return builder.toString();
    }
    
}
